using System;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Security;
using Stimulus360.Captcha;
using Stimulus360.Models.Data;
using Stimulus360.Services;
using Stimulus360.Services.Interfaces;

namespace Stimulus360.Controllers
{
    // The FormsAuthentication type is sealed and contains static members, so it is difficult to
    // unit test code that calls its members. The interface and helper class below demonstrate
    // how to create an abstract wrapper around such a type in order to make the AccountController
    // code unit testable.

    /// <summary>
    ///     Manage Forms authentication for Stimulus360
    /// </summary>
    public interface IFormsAuthentication
    {
        /// <summary>
        ///     Creates an authentication ticket for the supplied user name and adds it to the cookies collection of the response or the URL.
        /// </summary>
        /// <param name="userName">
        ///     Name of an authenticated user
        /// </param>
        /// <param name="createPersistentCookie">
        ///     True to create a cookie that is saved across browser sessions otherwise, false
        /// </param>
        void SignIn(string userName, bool createPersistentCookie);

        /// <summary>
        ///     Removes the forms-authentication ticket from the browser
        /// </summary>
        void SignOut();

        /// <summary>
        ///     Returns the redirect URL for the original request that caused the redirect to the login page.
        /// </summary>
        /// <param name="userName">
        ///     The name of the authenticated user.
        /// </param>
        /// <param name="createPersistentCookie">
        ///     This parameter is ignored.
        /// </param>
        /// <returns>
        ///     A string that contains the redirect URL.
        /// </returns>
        string Redirect(string userName, bool createPersistentCookie);
    }
}
